package com.bjx.common.core.domain.query;

import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
 * @desc: 基础查询
 * @author: liushuai
 * @date: 2022/8/15 14:35
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
public class BaseQuery {
    @Schema(title = "size",description = "每页条数")
    private Long size;
    @Schema(title = "current",description = "当前第几页")
    private Long current;

    public Page getPage(){
        if(ObjectUtil.isAllNotEmpty(size,current)){
            return new Page<>(current,size);
        }
        return new Page<>();
    }
}
